/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package ch.hslu.dmg.model;

import java.io.Serializable;
import java.util.List;
import javax.persistence.*;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author zaoln
 */
@Entity
@Table(name = "Lieferant")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Lieferant.findAll", query = "SELECT l FROM Lieferant l"),
    @NamedQuery(name = "Lieferant.findByLieferantenid", query = "SELECT l FROM Lieferant l WHERE l.lieferantenid = :lieferantenid"),
    @NamedQuery(name = "Lieferant.findByName", query = "SELECT l FROM Lieferant l WHERE l.name = :name"),
    @NamedQuery(name = "Lieferant.findByAdresse", query = "SELECT l FROM Lieferant l WHERE l.adresse = :adresse"),
    @NamedQuery(name = "Lieferant.findByBankverbindung", query = "SELECT l FROM Lieferant l WHERE l.bankverbindung = :bankverbindung")})
public class Lieferant implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy=GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "Lieferanten_id")
    private Long lieferantenid;
    @Column(name = "Name")
    private String name;
    @Column(name = "Adresse")
    private String adresse;
    @Column(name = "Bankverbindung")
    private String bankverbindung;
    @OneToMany(mappedBy = "lieferantid")
    private List<Teil> teilList;

    public Lieferant() {
    }

    public Lieferant(Long lieferantenid) {
        this.lieferantenid = lieferantenid;
    }

    public Long getLieferantenid() {
        return lieferantenid;
    }

    public void setLieferantenid(Long lieferantenid) {
        this.lieferantenid = lieferantenid;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getAdresse() {
        return adresse;
    }

    public void setAdresse(String adresse) {
        this.adresse = adresse;
    }

    public String getBankverbindung() {
        return bankverbindung;
    }

    public void setBankverbindung(String bankverbindung) {
        this.bankverbindung = bankverbindung;
    }

    @XmlTransient
    public List<Teil> getTeilList() {
        return teilList;
    }

    public void setTeilList(List<Teil> teilList) {
        this.teilList = teilList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (lieferantenid != null ? lieferantenid.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Lieferant)) {
            return false;
        }
        Lieferant other = (Lieferant) object;
        if ((this.lieferantenid == null && other.lieferantenid != null) || (this.lieferantenid != null && !this.lieferantenid.equals(other.lieferantenid))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "fp.Lieferant[ lieferantenid=" + lieferantenid + " ]";
    }
    
}
